package org.example.ObserverPattern;


/**
 * 具体观察者类：支持不同通知策略
 */
public class ConcreteObserver implements Observer {
    private String name;
    private NotificationStrategy notificationStrategy;

    public ConcreteObserver(String name, NotificationStrategy strategy) {
        this.name = name;
        this.notificationStrategy = strategy;
    }

    @Override
    public void update(String message) {
        notificationStrategy.sendNotification(message, name);
    }
}